* Calculations for Tables A3 and A5
* All CCES datasets downloaded from CCES Dataverse

** 2008 Calculations
* Open CCES data and set weights
use "cces_2008_common.dta", clear
svyset [pw=V201]

* Create variable indicating if respondent does not have a validated vote record
gen no_record=1 if vote_gen08>1
recode no_record .=0

* Calculate share of people who said they voted for whom no validated vote record 
* was found by race/ethnicity for Table A3
* Exclude those in VA since records not available for that state in 2008
svy: tab no_record V211 if CC403==5 & V259!=51, col

* Create variable for whether respondent over-reported their tunout 
*(1 if claimed they voted but did not)
gen overreport=1 if no_record==1 & CC403==5
replace overreport=0 if CC403<5 | (CC403==5 & no_record==0)

* Calculate rate of over-reporting by race/ethnicity for Table A5
svy: tab overreport V211, col

** 2010 Calculations
* Open CCES data and set weights
use "cces_2010_common_validated.dta", clear
svyset [pw=V101]

* Create variable indicating if respondent does not have a validated vote record
gen no_record=1 if vote_gen10>1
recode no_record .=0

* Calculate share of people who said they voted for whom no validated vote record 
* was found by race/ethnicity for Table A3
svy: tab no_record V211 if CC401==5 & V206_post!=51, col

* Create variable for whether respondent over-reported their tunout 
*(1 if claimed they voted but did not)
gen overreport=1 if no_record==1 & CC401==5
replace overreport=0 if CC401<5 | (CC401==5 & no_record==0)

* Calculate rate of over-reporting by race/ethnicity for Table A5
svy: tab overreport V211, col

** 2012 Calculations
* Open CCES data and set weights
use "CCES12_Common_VV.dta", clear
svyset [pw=V103]

* Create variable indicating if respondent does not have a validated vote record
gen no_record=1 if e2012g=="" | e2012g=="MatchedNoVote"
recode  no_record .=0

* Calculate share of people who said they voted for whom no validated vote record 
* was found by race/ethnicity for Table A3
svy: tab no_record race if CC401==5, col 

* Create variable for whether respondent over-reported their tunout 
*(1 if claimed they voted but did not)
gen overreport=1 if no_record==1 & CC401==5
replace overreport=0 if CC401<5 | (CC401==5 & no_record==0)

* Calculate rate of over-reporting by race/ethnicity for Table A5
svy: tab overreport race, col

** 2014 Calculations
* Open CCES data and set weights
use "CCES14_Common_Content_Validated.dta", clear

svyset [pw=weight]

* Create variable indicating if respondent does not have a validated vote record
gen no_record=1 if e2014gvm=="" 
recode  no_record .=0

* Calculate share of people who said they voted for whom no validated vote record 
* was found by race/ethnicity for Table A3
svy: tab no_record race if CC401==5, col

* Create variable for whether respondent over-reported their tunout 
*(1 if claimed they voted but did not)
gen overreport=1 if no_record==1 & CC401==5
replace overreport=0 if CC401<5 | (CC401==5 & no_record==0)

* Calculate rate of over-reporting by race/ethnicity for Table A5
svy: tab overreport race, col

** 2016 calculations
* Open CCES data and set weights
use "CCES16_Common_OUTPUT_Feb2018_VV.dta", clear
svyset [pw=commonweight_post]

* Create variable indicating if respondent does not have a validated vote record
gen no_record=1 if CL_E2016GVM=="" 
recode  no_record .=0

* Calculate share of people who said they voted for whom no validated vote record 
* was found by race/ethnicity for Table A3
svy: tab no_record race if CC16_401==5, col

* Create variable for whether respondent over-reported their tunout 
*(1 if claimed they voted but did not)
gen overreport=1 if no_record==1 & CC16_401==5
replace overreport=0 if CC16_401<5 | (CC16_401==5 & no_record==0)

* Calculate rate of over-reporting by race/ethnicity for Table A5
svy: tab overreport race, col

** 2018 calculations
* Open CCES data and set weights
use "cces18_common_vv.dta", clear
svyset [pw=commonpostweight]

* Create variable indicating if respondent does not have a validated vote record
gen no_record=1 if CL_2018gvm==.
recode  no_record .=0

* Calculate share of people who said they voted for whom no validated vote record 
* was found by race/ethnicity for Table A3
svy: tab no_record race if CC18_401==5, col 

* Create variable for whether respondent over-reported their tunout 
*(1 if claimed they voted but did not)
gen overreport=1 if no_record==1 & CC18_401==5
replace overreport=0 if CC18_401<5 | (CC18_401==5 & no_record==0)

* Calculate rate of over-reporting by race/ethnicity for Table A5
svy: tab overreport race, col
